﻿@using PortalCurriculo.MvcWebUI.Resources.Curriculo
@using PortalCurriculo.MvcWebUI.Resources.Geral
@model PortalCurriculo.MvcWebUI.Models.CargoCurriculoModel
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function onCargoCurriculoFailure(context) {
        alert($(context.responseText)[2].text);
    }    
</script>
@using (Ajax.BeginForm("Adicionar", new AjaxOptions { UpdateTargetId = "listaCargoCurriculo", OnFailure = "onCargoCurriculoFailure" }))
{
    <fieldset>
        <legend>@Geral.CargosPretendidos</legend>
        @Html.Action("Selecionar", "Cargo", new { idCargo = Model == null ? 3 : Model.IdCargo })
        @Html.Hidden("IdCurriculo")
        @if (ViewBag.Id != null && !string.IsNullOrEmpty(ViewBag.Id.ToString()))
        {
            @Html.Hidden("Id")
        }
        <div class="floatRight" style="padding-top: 5px;">
            @Ajax.ActionLink(Botoes.Novo, "Registro", new { idCurriculo = ViewBag.IdCurriculo, id = 0 },
             new AjaxOptions { UpdateTargetId = "editFormCargoCurriculo" }, new { 
                 @class = "buttonAdicionar buttonPadding ui-button ui-widget ui-state-default ui-corner-all" })
            <input type="submit" value="@Botoes.Salvar" class="buttonSave ui-button ui-widget ui-state-default ui-corner-all"  />
        </div>
    </fieldset>
}